package vip.source.pattern.part15.iterator;

import org.junit.jupiter.api.Test;

/**
 * @Description: 迭代器测试
 * @Author: zy
 **/
public class UnitTest {
    @Test
    public void test() {
        BookCollection bookCollection = new BookCollection();
        bookCollection.addBook(new Book("Design Patterns"));
        bookCollection.addBook(new Book("Clean Code"));
        bookCollection.addBook(new Book("Java Programming"));

        Iterator iterator = bookCollection.iterator();
        while (iterator.hasNext()) {
            Book book = (Book) iterator.next();
            System.out.println("Book Title: " + book.getTitle());
        }
    }
}
